<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="css/eui.css">
    <style>
        body{
            margin: 0;
            background-image: url("img/bg1.jpg");
            background-size: cover;
            text-align: center;
        }
        h1{
            font-size: 72px;
            color:#5FB878;
            margin-bottom: 0;
        }
        img{
            width: 100px;
        }
        .logo{
            width: 300px;
            height: 300px;
        }
    </style>
</head>
<body>
<div id="app">
    <h1>环绿回收</h1><br>
    <el-card style="width: 600px;height: 300px;
    margin: 0 auto;background-color: rgba(255,255,255,0.3)">
        <el-container style="width: 600px">
            <el-aside>
                <el-form style="width: 400px;margin: 30px auto" label-width="60px" >
                    <el-form-item label="用户名">
                        <el-input type="text" v-model="user.loginKey" placeholder="请输入用户名"></el-input>
                    </el-form-item>
                    <el-form-item label="密码">
                        <el-input type="password" v-model="user.password" placeholder="请输入密码"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button  style="position: relative;right: 35px" type="primary" @click="login()">登录</el-button>
                        <el-button  style="position: relative;right: 35px" type="primary" >
                          <el-form class="resp-tab-item"><a style="text-decoration: none;color: #d9ecff" href="login2.html">快捷登录</a></span></el-form>
                        </el-button>
                        </el-form-item>
                </el-form>
            </el-aside>
            <el-main>
                <div class="head agile">
                    <div class="logo">
                        <div class="logo-top wel">
                            <img src="img/login-icon.jpg" alt="image"/>
                            <h2>欢迎</h2>
                        </div>
                        <el-button style="text-align: center"><a style="text-decoration: none" href="register1.html">注册</a></el-button>
                        <el-button style="text-align: center"><a style="text-decoration: none"  href="RetrievePassword.html">忘记密码</a></el-button>
                    </div>
                </div>
            </el-main>
        </el-container>
            </el-card>
</div>
</body>
<!-- import Vue before Element -->
<script src="js/vue.js"></script>
<!-- import JavaScript -->
<script src="js/eui.js"></script>
<script src="js/axios.min.js"></script>
<script>
    let v = new Vue({
        el: '#app',
        data: function() {
            return {
                user:{
                    loginKey:"",
                    password:""
                }
            }
        },
        methods:{
            login(){
                axios.post("/userLoginAccount/loginByPassword",v.user).then(function (response) {
                    if (response.data.states===20000){
                        if (v.user.loginKey==1234567){
                            location.href="/adminIndex.html"; //显示管理页面
                        }else if (v.user.loginKey==12345678){
                            location.href="/superIndex.html"; //显示管理页面
                        }else{
                            location.href="/userIndex.html"; //显示管理页面
                        }

                    }else if (response.data.states===40101){
                        v.$message.error("用户名不存在!");
                    }else{
                        v.$message.error("密码错误!");
                    }
                })
            }
        }
    })
</script>
</html>
